package com.medicine.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.springframework.aop.ThrowsAdvice;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import exception.YpkcxxNotFind;
import exception.ZgxxNotFind;
import pagination.Page;
import po.Rkxx;
import po.Ypkcxx;
import po.Ypxx;
import po.Zgxx;
import requestvo.ApplyRepairReqVo;
import requestvo.ApplyRepairReqVo;
import requestvo.RkxxReqVo;
import requestvo.YpkcxxReqVo;

@Service
public class ApplyRepairService extends BaseServiceImpl{
	
	public Page findsbbxxx(ApplyRepairReqVo applyRepairReqVo){
		Page<ApplyRepairReqVo> page=new Page<>();
		if (applyRepairReqVo.getId() != null&&!applyRepairReqVo.getId().equals("")){
			page.getParams().put("id", applyRepairReqVo.getId());
		}
		if (applyRepairReqVo.getSb_no() != null&&!applyRepairReqVo.getSb_no().equals("")){
			page.getParams().put("sb_no", applyRepairReqVo.getSb_no());
		}
		if (applyRepairReqVo.getSb_name() != null&&!applyRepairReqVo.getSb_name().equals("")){
			page.getParams().put("sb_name", applyRepairReqVo.getSb_name());
		}	
		if(applyRepairReqVo.getTech_name()!=null&&!applyRepairReqVo.getTech_name().equals("")) {
			page.getParams().put("tech_name", applyRepairReqVo.getTech_name());
		}		
		if(applyRepairReqVo.getSys_name()!=null&&!applyRepairReqVo.getSys_name().equals("")) {
			page.getParams().put("sys_name", "%"+applyRepairReqVo.getSys_name()+"%");
		}
		if(applyRepairReqVo.getCount()!=null&&!applyRepairReqVo.getCount().equals("")){
			page.getParams().put("count", applyRepairReqVo.getCount());
		}
		if(applyRepairReqVo.getApplyrepairtime()!=null&&!applyRepairReqVo.getApplyrepairtime().equals("")){
			page.getParams().put("applyrepairtime", applyRepairReqVo.getApplyrepairtime());
		}
		if(applyRepairReqVo.getApplyrepairtime1()!=null&&!applyRepairReqVo.getApplyrepairtime1().equals("")){
			page.getParams().put("applyrepairtime1", applyRepairReqVo.getApplyrepairtime1());
		}
		if(applyRepairReqVo.getApplyrepairtime2()!=null&&!applyRepairReqVo.getApplyrepairtime2().equals("")){
			page.getParams().put("applyrepairtime2", applyRepairReqVo.getApplyrepairtime2());
		}
		page.setPageNo(applyRepairReqVo.getPage());
		page.setPageSize(applyRepairReqVo.getRows());
		page.setResults(applyRepairDao.findPage(page));
		return page;
	}

	public void updatesbbxxx(ApplyRepairReqVo applyRepairReqVo) {
		// TODO Auto-generated method stub
		applyRepairDao.update(applyRepairReqVo);
		
	}
	
	public void addsbbxxx(ApplyRepairReqVo applyRepairReqVo) {
		// TODO Auto-generated method stub
		applyRepairDao.insert(applyRepairReqVo);
		/*Ypkcxx	ypkcxx  = ypkcxxDao.get(applyRepairReqVo.getyPBM());
		if(ypkcxx==null){
			throw new YpkcxxNotFind(rkxx.getyPBM());		
		}
		else{
			Zgxx zgxx=zgxxDao.get(rkxx.getzGBM());
			if(zgxx==null) throw new ZgxxNotFind(rkxx.getzGBM());
			ypkcxx.setyPSL(ypkcxx.getyPSL()+rkxx.getrKL());
			applyRepairDao.update(ypkcxx);
		}*/
	}
	public void delsbbxxx(Integer[] integers) {
		// TODO Auto-generated method stub
		applyRepairDao.delete(integers);
	}

}
